﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/Scripts/js/jquery.min.js"></script>
    <script src="~/Scripts/js/bootstrap.min.js"></script>
    <title>Record_if</title>
</head>
<body>
    <div id="div">
       
        
    </div>
</body>
</html>
<script>
    $(function () {
        $.ajax({
            url: "",
            success:function(obj)
            {
                obj = JSON.parse(obj);
                alert(obj)
                for (var i = 0; i < obj.length; i++) {
                    var s = "";
                    s += '<table id="t1" class="table-bordered table table-condensed table-responsive">';
                    s += '<thead>'
                    s += '<tr><td>员工编号</td><td>员工姓名</td><td>变更状态</td><td>变更职位</td><td>变更部门</td><td>申请理由</td><td>结果</td></tr></thead>';
                    s += '<tbody>'
                    for (var i = 0; i < obj.length; i++) {
                        if (obj[i].ApplyStatu != 0)
                        {
                            if (obj[i].ChangeStatu == 1) {
                                if (obj[i].ApplyStatu == -1)
                                {
                                    s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>晋升申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_Reason + '</td><td>申请失败</td></tr>'
                                } else if(obj[i].ApplyStatu ==1) {
                                    s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>晋升申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_Reason + '</td><td>申请成功</td></tr>'
                                }
                               
                            }
                            else if (obj[i].ChangeStatu == 2) {
                                if (obj[i].ApplyStatu == -1)
                                {
                                    s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>降职申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_Reason + '</td><td>申请失败</td></tr>'
                                }
                                else if(obj[i].ApplyStatu ==1)
                                {
                                    s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>降职申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_Reason + '</td><td>申请成功</td></tr>'
                                }
                               
                            }
                        }
                       
                    }
                }
                s += '</tbody>'
                s += '</table>'
                $("#div").html(s);
            }

        })
    })
</script>
